<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/icon.css">
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/locale/easyui-lang-zh_CN.js"></script>
		<script>

		$(function(){
					
			/*表格初始化*/
			$("#grid").datagrid({
				singleSelect:true,
				fit:true,
				fitColumns:true,
				collapsible:true, 
				striped:true,
				rownumbers:true, 
			    columns:[[    
			    	{field:'CK',checkbox:true},
			        {field:'table_code',title:'表名',width:100,align:'center'}
			    ]]
			});
			

			function query(){
				$("#grid").datagrid({
					url:'/dataTransferConfig/dataMerge/getDataMergeList',
					method:"POST",
					queryParams: parent.getFormJson($("#search_form"))
				});
			}
			
			//查询按钮
			$("#search_btn").click(query);
			query();
			
			//执行按钮
			$("#exe_btn").click(function(){
				
				var rows = $('#grid').datagrid('getSelections');
				if(rows.length<1){
					$.messager.alert('提示','请勾选一条');
					return false;
				}
				var table_code = rows[0].table_code;
				
				$.post("/dataTransferConfig/dataMerge/execOneTable",{table_code:rows[0].table_code},function(response){
					$.messager.alert('提示',response);
					$("#grid").datagrid('reload');
				})
			});
			
			
		});
			
		</script>
	</head>
	<body class="easyui-layout">
		
		<!-- 查询条件表单 -->
		<div region="north" border="false"   style="width:100%;height:80px;margin-top: 20px;" >
			<form id ="search_form" method="post" class="easyui-form">
				<table width="100%">
					<tr>
						<td align="right" width="15%">表名称:</td>
						<td width="15%"  align="left" >
							<input class="easyui-textbox"  name="table_code" style="width:200px"  />
						</td>
						<td width="15%" ></td>
					</tr>
				</table>

			</form>
			
			<a href="#" id="search_btn" class="easyui-linkbutton"	 data-options="iconCls:'icon-search'"  >刷新</a>
			<a href="#" id='exe_btn' class="easyui-linkbutton"  data-options="iconCls:'icon-reload'">手工执行</a>
		</div>
		
		<!-- 主表格 -->
		<div region="center" border="false">
			
			<table id="grid" ></table>
		</div>
	</body>
</html>
